﻿using Test.Utility.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test.Site.Data.Constant
{
    public class FileSaveRule
    {
        /// <summary>
        /// /AdminFaceImg 
        /// </summary>
        public const string AdminFaceSavePath = "~/Uploads/AdminFaceImg/";

        /// <summary>
        /// /UserFaceImg
        /// </summary>
        public const string UserFaceSavePath = "~/Uploads/UserData/{0}/UserFaceImg";

        #region 例子
        ///// <summary>
        ///// 求助分类图片
        ///// </summary>
        //public const string NeedTypeSavePath = "~/Uploads/NeedTypeImages/";

        ///// <summary>
        ///// 求助图片（按月保存）
        ///// </summary>
        //public static string NeedImageMonthlySavePath { get { return GetMonthlyPath("~/Uploads/NeeImage/{0}"); } }

        ///// <summary>
        ///// 求助图片（按日保存）
        ///// </summary>
        //public static string NeedImageDailySavePath { get { return GetDailyPath("~/Uploads/NeeImage/{0}"); } }

        ///// <summary>
        ///// 帮助图片（按月保存）
        ///// </summary>
        //public static string HelpImageMonthlySavePath { get { return GetMonthlyPath("~/Uploads/HelpImage/{0}"); } }

        ///// <summary>
        ///// 帮助图片（按日保存）
        ///// </summary>
        //public static string HelpImageDailySavePath { get { return GetDailyPath("~/Uploads/HelpImage/{0}"); } }
        #endregion

        /// <summary>
        /// 按月生成路径
        /// </summary>
        /// <param name="basePath"></param>
        /// <param name="param1"></param>
        /// <returns></returns>
        public static string GetMonthlyPath(string basePath)
        {
            return string.Format(basePath, DateTime.Now.ToString("yyyyMM").GetMD5Hash());
        }

        /// <summary>
        /// 按日生成路径
        /// </summary>
        /// <param name="basePath"></param>
        /// <returns></returns>
        public static string GetDailyPath(string basePath)
        {
            return string.Format(basePath, DateTime.Now.ToString("yyyyMMdd").GetMD5Hash());
        }
    }
}
